package com.shanghaionstar.mro.util;

import android.graphics.Bitmap;
import android.graphics.Matrix;

/**
 * Bitmap???
 * 
 * @author Zengshuai Shi
 * 
 */
public class BitmapZoomUtils {

	// public Bitmap getZoom(Bitmap bitmap) {
	// width = bitmap.getWidth();
	// height = bitmap.getHeight();
	// scaleHeight = (float) ((Math.random() * 10 + 1) / 10);
	// Matrix matrix = new Matrix();
	// matrix.postScale(1f, scaleHeight);
	// newBitmap = Bitmap.createBitmap(bitmap, 0, 0, width, height, matrix,
	// true);
	// return newBitmap;
	// }
	public Bitmap getZoom(Bitmap bitmap, float scaleWidth, float scaleHeight) {
		if (bitmap != null) {
			int width = bitmap.getWidth();
			int height = bitmap.getHeight();
			Matrix matrix = new Matrix();
			matrix.postScale(scaleWidth, scaleHeight);
			Bitmap newBitmap = Bitmap.createBitmap(bitmap, 0, 0, width, height,
					matrix, true);
			return newBitmap;
		} else {
			return null;
		}
	}
}
